home *** CD-ROM | disk | FTP | other *** search
- on setUp buttonSprite, spec, graphicSprite, Destination
- global actions, buttons
- if buttonSprite = #NEW then
- initSetUp()
- exit
- end if
- if buttonSprite = #BLINK then
- add(actions, [#BLINK, spec, graphicSprite])
- exit
- end if
- if ilk(buttonSprite) <> #integer then
- setUpHelp(buttonSprite)
- exit
- end if
- setCursor(spec, buttonSprite)
- if ilk(graphicSprite) = #integer then
- set the visible of sprite graphicSprite to 0
- end if
- add(buttons, [buttonSprite, spec, graphicSprite, Destination])
- end
-
- on initSetUp
- global mouseState, buttons, actions, lastBlink
- set buttons to []
- set actions to []
- set lastBlink to 0
- set mouseState to #UP
- end
-
- on FrameLoop
- global aState, dState, buttons
- repeat with def in buttons
- set buttonSprite to getAt(def, 1)
- set spec to getAt(def, 2)
- set graphicSprite to getAt(def, 3)
- set Destination to getAt(def, 4)
- if rollOver(buttonSprite) then
- set mState to getMouseState()
- if spec = #A then
- if mState = #down then
- doClick()
- if aState = 1 then
- set the visible of sprite graphicSprite to 0
- end if
- else
- if mState = #UP then
- if aState = 0 then
- set aState to 1
- set the visible of sprite graphicSprite to 1
- else
- set aState to 0
- end if
- else
- set the visible of sprite graphicSprite to 1
- end if
- end if
- else
- if spec = #B then
- else
- if spec = #C then
- if the visible of sprite Destination = 0 then
- set the visible of sprite graphicSprite to 1
- end if
- else
- if spec = #D then
- if mState = #down then
- doClick()
- set the visible of sprite graphicSprite to 1
- else
- if mState = #UP then
- set the visible of sprite graphicSprite to 0
- GoTo(Destination, buttonSprite, graphicSprite)
- end if
- end if
- else
- if spec = #E then
- if mState = #down then
- doClick()
- if ilk(graphicSprite) = #integer then
- set the visible of sprite graphicSprite to 1
- end if
- end if
- if mState = #UP then
- setCursor(spec, buttonSprite)
- go(Destination)
- exit
- end if
- end if
- end if
- end if
- end if
- end if
- next repeat
- end if
- if (spec = #A) and (aState <> 1) then
- set the visible of sprite graphicSprite to 0
- end if
- if spec = #C then
- set the visible of sprite graphicSprite to 0
- end if
- end repeat
- doActions()
- end
-
- on doActions
- global actions, lastBlink
- set ptr to 1
- repeat while ptr <= count(actions)
- set action to getAt(actions, ptr)
- set actionName to getAt(action, 1)
- set n to getAt(action, 2)
- set graphicSprite to getAt(action, 3)
- if actionName = #BLINK then
- if (the timer > lastBlink) and ((n >= 0) or (n = #FOREVER)) then
- if the visible of sprite graphicSprite = 1 then
- set the visible of sprite graphicSprite to 0
- else
- set the visible of sprite graphicSprite to 1
- if n <> #FOREVER then
- set n to n - 1
- setAt(action, 2, n)
- setAt(actions, ptr, action)
- if n < 0 then
- set the visible of sprite graphicSprite to 0
- end if
- end if
- end if
- set lastBlink to the timer + 20
- end if
- end if
- set ptr to ptr + 1
- end repeat
- end
-
- on setCursor spec, sNum
- if (spec = #A) or (spec = #D) or (spec = #E) then
- set the cursor of sprite sNum to [cast "Hand Cursor", cast "hand cursor alpha"]
- else
- if spec = #B then
- alert("custom programming requested - ask mark")
- else
- if spec = #C then
- end if
- end if
- end if
- end
-
- on getMouseState
- global mouseState
- if the mouseDown then
- if mouseState <> #down then
- set mouseState to #down
- return mouseState
- end if
- end if
- if the mouseUp then
- if mouseState <> #UP then
- set mouseState to #UP
- return mouseState
- end if
- end if
- return #NONE
- end
-
- on GoTo Destination, buttonSprite, graphicSprite
- set the cursor of sprite buttonSprite to -1
- go(Destination)
- end
-
- on doClick
- puppetSound("click")
- updateStage()
- end
-
- on setUpHelp spec
- if (spec = #A) or (ilk(spec) = #void) then
- put "Spec #A requires a graphicSprite but no frame destination"
- put "ie: set(11, #A, 7, VOID)"
- put " 11 is the sprite number of the button"
- put " #A is the navigation specification"
- put " 7 is the graphic which turns on or off."
- put " The frame does not change with Spec #A"
- put RETURN
- end if
- if (spec = #B) or (ilk(spec) = #void) then
- put "Spec #B has not been implemented yet. Ask Mark to get busy!"
- put RETURN
- end if
- if (spec = #C) or (ilk(spec) = #void) then
- put "Spec #C requires a graphicSprite but no frame destination"
- put "ie: set(11, #C, 7, VOID)"
- put " 11 is the sprite number of the button"
- put " #A is the navigation specification"
- put " 7 is the graphic which turns on or off"
- put " The frame does not change with Spec #C"
- put RETURN
- end if
- if (spec = #D) or (ilk(spec) = #void) then
- put "Spec #D requires a graphicSprite but no frame destination"
- put "ie: set(11, #D, 7, VOID)"
- put " 11 is the sprite number of the button"
- put " #D is the navigation specification"
- put " 7 is the graphic which turns on or off"
- put " The frame does not change with Spec #D"
- put RETURN
- end if
- if (spec = #E) or (ilk(spec) = #void) then
- put "Spec #E requires no graphicSprite but requires a frame destination"
- put "ie: set(11, #E, VOID," & QUOTE & "answers" & QUOTE & ")"
- put " 11 is the sprite number of the button"
- put " #E is the navigation specification"
- put " No graphic turns on or off"
- put " The frame jumps to 'answers' when the button is clicked"
- put RETURN
- end if
- end
-
- on palettes
- global palettes
- put "palette check:"
- set palettes to 0
- repeat with i = 1 to the number of castMembers
- if the castType of cast i = #bitmap then
- if the depth of cast i > 1 then
- if the palette of cast i <> 1 then
- put "cast:" & i && "(" & the name of cast i & "&)" && "bitdepth:" & the depth of cast i && "palete:" & the palette of cast i
- end if
- end if
- end if
- end repeat
- put "done"
- end
-